package com.ordertracker.persistent.dictionary.template;

import com.ordertracker.persistent.dictionary.template.OptimisticLockTemplate;

import javax.persistence.*;

/**
 * Description of class.
 * Created 1/18/13 4:18 PM
 *
 * @author andrey.rodin@playtech.com
 */

@MappedSuperclass
public abstract class AbstractEmployeeTemplate extends StateEntityTemplate {

    @Column
    private String name;

    @Column
    private int code;

    protected AbstractEmployeeTemplate() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AbstractEmployeeTemplate)) return false;

        AbstractEmployeeTemplate that = (AbstractEmployeeTemplate) o;

        if (code != that.code) return false;
        if (!name.equals(that.name)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + code;
        return result;
    }

    @Override
    public String toString() {
        return "name='" + name + '\'' +
                ", code=" + code +
                '}';
    }
}
